package com.example.demo.controller;

import com.example.demo.Service.IProductHotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/hot")
@CrossOrigin(origins = "*")
public class ProductHotController {

    @Autowired
    private IProductHotService productHotService;

    @GetMapping()
    public Map<String,Object> hot(){
        Map<String,Object> map = new HashMap<>();

        map.put("total",productHotService.count());
        map.put("rows",productHotService.list());
        map.put("code",200);
        map.put("msg","查询成功");
        return map;
    }


}
